package ms.unicorn.modellanguage;

import ms.unicorn.Element;
import ms.unicorn.language.languagedef.LanguageDef;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.xtext.xbase.interpreter.IEvaluationContext;
import org.eclipse.xtext.xbase.interpreter.IExpressionInterpreter;

@SuppressWarnings("restriction")
public interface IModelLanguage {
	
	String getPluginID();
	
	String getId();
	
	LanguageDef getDefinition();
	
	void setDefinition(LanguageDef definition);
	
	/**
	 * Get the name of the modeling language
	 * @return name of modeling language 
	 */
	String getName();
		
	/**
	 * Initialize settings for a new element of the language.
	 * @param element The new element to be initialized
	 * @param request A configure request object containing context information for configuration
	 */
	void configElement(Element element, ConfigureRequest request);
		
	/**
	 * Get the number of elements supported by this language.
	 * @return An integer number indicates total elements.
	 */
	int getElementCount();
	
	/**
	 * Add a new element supported by this language.
	 * @param element The new element.
	 */
	void addElement(LanguageElement element);
	
	/**
	 * Get a language element by index. 
	 * @param idx The index of the element to get.
	 * @return The <code>ILanguageElement</code> at the given index.
	 */
	LanguageElement getElement(int idx);
	
	/**
	 * Get a language element by id (or element type).
	 * @param id The id (or type name) of the element to get. 
	 * @return The <code>ILanguageElement</code> whose id equals to the give id.
	 */
	LanguageElement getElement(String id);
	
	/**
	 * Remove an element from the language.
	 * @param id The id (or type name) of the element to be removed.
	 */
	void removeElement(String id);

	void registerElementTypes();

	Object getCachedObject(String typeName);

	void setCachedObject(Object object);

	void initialize(IConfigurationElement item);
	
	public IEvaluationContext getContext();
	
	public IExpressionInterpreter getInterpreter();
}
